const path = require('path');

module.exports = {
  webpack: {
    alias: {
      "@": path.resolve(__dirname, 'src'),
      'components': path.resolve(__dirname, 'src/components')
    },
    configure: (webpackConfig, { env, paths }) => {
      const oneOfRule = webpackConfig.module.rules.find((rule) =>
        Array.isArray(rule.oneOf)
      )
      oneOfRule.oneOf.unshift({
        test: /.svg$/i,
        include: path.resolve('src/assets/svg'), // 只处理需要处理的文件
        use: [
          {
            loader: 'svg-sprite-loader',
            options: {
              symbolId: 'icon-[name]'
            }
          }
        ]
      })
      return webpackConfig
    }
  }
}
 